/**
 * 
 */
package com.witframework.meta;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.javalid.annotations.core.JvMethod;
import org.javalid.annotations.helper.Lookup;
import org.javalid.annotations.helper.SpringLookup;
import org.javalid.annotations.validation.LovConstraint;
import org.springmodules.validation.bean.conf.loader.annotation.handler.Length;

import com.witframework.core.annotations.Wit;

/**
 * 表的元数据描述
 * 
 * @author wuxinyang Jun 5, 2009 3:38:04 PM
 */

@Entity
@Table(name = "Meta_Table_Ref")
@Wit(cnname = "表的引用完整性元数据")
public class MetaTableReferentialIntegrity extends BaseMetaObject {
		
	@Column(length=1) @Length(max=1) @Wit(cnname="导入？", description="导入导出？")
	private String pkfk;//"P" 导入，"F"导出
	
	@Column(length=127) @Length(max=127) @Wit(cnname="主表名", description="主表名")
	private String pkTableName;
	
	@Column(length=127) @Length(max=127) @Wit(cnname="主表列名", description="主表列名")
	private String pkColumnName;
	
	@Column(length=127) @Length(max=127) @Wit(cnname="外表名", description="外表名")
	private String fkTableName;
	
	@Column(length=127) @Length(max=127) @Wit(cnname="外表列名", description="外表列名")
	private String fkColumnName;	

	@ManyToOne@LazyToOne(LazyToOneOption.FALSE)	
	@LovConstraint(
			dynamic=true,lookup=@Lookup(type=Lookup.LOOKUP_SPRING_BEAN,springLookup=@SpringLookup(name="metaTableService",method=@JvMethod(name="getAll")))
	)
	private MetaTable metaTable;

	public String getPkfk() {
		return pkfk;
	}

	public void setPkfk(String pkfk) {
		this.pkfk = pkfk;
	}

	public String getPkTableName() {
		return pkTableName;
	}

	public void setPkTableName(String pkTableName) {
		this.pkTableName = pkTableName;
	}

	public String getPkColumnName() {
		return pkColumnName;
	}

	public void setPkColumnName(String pkColumnName) {
		this.pkColumnName = pkColumnName;
	}

	public String getFkTableName() {
		return fkTableName;
	}

	public void setFkTableName(String fkTableName) {
		this.fkTableName = fkTableName;
	}

	public String getFkColumnName() {
		return fkColumnName;
	}

	public void setFkColumnName(String fkColumnName) {
		this.fkColumnName = fkColumnName;
	}

	public MetaTable getMetaTable() {
		return metaTable;
	}

	public void setMetaTable(MetaTable metaTable) {
		this.metaTable = metaTable;
	}
	
}
